<?php

	header("Content-Type: text/html;charset=utf-8");

	include("function/_nosql.php"); //
	include("function/function.php");

	include("_include.user.judge.php");

	$newsid = trim($_REQUEST['newsid']);

	$kboy_userid = $_SESSION['kboy_userid'];
	
	
	if(isset($_GET['oid'])){
				$sql = "delete from kboy_order where id =".$_GET['oid'];
				$rows=mysql_query($sql);
		if($rows){
			echo erro("删除成功");
		}
	}
	
	if(is_numeric($newsid)){

		$sql="select * from kboy_forum_active where id=$newsid and uid=".$kboy_userid;

		$rows=mysql_query($sql);

		$nums=mysql_num_rows($rows);

		if($nums>0){

			$rs=mysql_fetch_array($rows);

		}

		else{

		 echo erro("该信息已被删除或不存在");

		}

	 }

	 else{

	 echo erro("该信息已被删除或不存在");

	 }

function str_count($sql,$str){

 $res = mysql_query($sql);

 $num = mysql_num_rows($res);

 $count = 0;

  if($num>0){

	while($arr=mysql_fetch_array($res)){

	 $count = $count + $arr[$str];

	}

  }

  return $count;

}	

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>中国徒步网</title>

    <link rel="stylesheet" href="css/common.css"/>

    <link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
    <script type="text/javascript" src="js/laydate/laydate.js"></script>

</head>

<body>

    <!--top-bar begin-->

    <? include("_include.top.topbar.php") ?>

    <!--top-bar end-->

    <!--banner begin-->

    <? include("_include.user.topbar.php")?>

    <!--banner end-->

    <!--member center-->

    <div class="member-box">

        <div class="content">

            <? include("_include.user.leftnav.php") ?>

            <div class="member-box-r">

                <div class="member-item1">

                    <div class="m-title">报名人员列表</div>

                    <?php include_once('_include.user.ordersearch.php');?>

                </div>

                <div class="bm_wrap">

                    <div class="hd_title">

                        <div class="l_mc"><span>活动名称：</span><a href="activeview.php?newsid=<?php echo $rs['id'];?>"><?php echo $rs['active_title'];?></a></div>

                        <div class="r_mc"><span>报名人数：</span><?=str_count("select * from  kboy_order where aid=".$newsid."  group by uid","order_num");?>人</div>

                    </div>

                    <div class="bd_list">

					

					<?php

						$SQL = " where aid=$newsid  ";

						$pagesize = 5; // 分页数量

						$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值

						if($pageval){

							if(!is_numeric($pageval)){

								echo erro("Page Error");

							}

							if($pageval <= 1){

								$pageval = 1;

							}

							$page = ($pageval-1) * $pagesize;

							$page .= ",";

						}else{

							$pageval = 1;

						}

						

						if($SQL != ""){

							$pagesql = "select * from kboy_order ".$SQL."   group by uid order by id desc ";

						}else{

							$pagesql = "select * from kboy_order where 1 group by uid order by id desc";

						}



						$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数

						$pagecount = ceil($pagenum/$pagesize); // 共分多少页

						if($pageval > $pagecount){

							$pageval = $pagecount;

						}

						

						$news_sql = $pagesql." limit $page $pagesize";

						$news_rows = mysql_query($news_sql);

						$i = 1;
							
						while($news_rs = mysql_fetch_array($news_rows)){

						?>

                        <div class="l_item">

                            <div class="pic"><a href="forum_news.php?uid=<?=$news_rs['uid'];?>"><img src="<?=getClassName("kboy_user","user_face","uid=".$news_rs['uid'])?>" alt="" /></a></div>

                            <div class="r_info">

                                <div class="r_info_hd"><a href="forum_news.php?uid=<?=$news_rs['uid'];?>"><?=getUserNickName($news_rs['uid'])?></a></div>
									<div class="shanchu_01">
		                            	<a href="./user_baoming_list.php?oid=<?=$news_rs['id']?>">删除</a>
		                            </div>
                                 <?php

								 $realname=explode('@@',$news_rs['order_realname']);

								 $phone=explode('@@',$news_rs['order_phone']);

								 $shangche=explode('@@',$news_rs['order_shangche']);
								$order_sex=explode('@@',$news_rs['order_sex']);
								 $idcard=explode('@@',$news_rs['order_idcard']);

								 $text=explode('@@',$news_rs['order_text']);

								 if($news_rs['order_isfull'] ==1){ 

								   $isfull = '全款';

								   if(getClassName("kboy_user","user_style","uid=".$kboy_userid) == 1 ){//cva

									 $money = getClassName("kboy_forum_active","active_cva_money","id=".$news_rs['aid']);  

								   }

								   else{

									 $money = getClassName("kboy_forum_active","active_all_money","id=".$news_rs['aid']);  

								   }

								   

								 }

								 else{

									$isfull = '预付款';

									$money = getClassName("kboy_forum_active","active_part_money","id=".$news_rs['aid']);

								 } 

								 $all_moeny = ($money*$news_rs['order_num']);

                                  for($i=0;$i<$news_rs['order_num'];$i++){

								  ?>

                                <div class="r_info_bd">

                                <?php if($i==0){ ?>

                                    <p>付款金额：<span class="price"><?=$all_moeny;?></span>（<?php echo $isfull; ?>
									<?php
											if($news_rs['order_state'] == 1){
												echo "已付款";
											}else{
												echo "<font color='red'>未付款</font>";
											}
									?>
									）</p><p style="clear:both"></p><?php } ?>

                                    <p>客户姓名: <span><?=$realname[$i];?></span></p>
                                    
									<p>性别: <span><?php 
										if($order_sex[$i]==1){
											echo '男';}else if($order_sex[$i]==0){echo '女';}?></span></p>

                                    <p>联系电话：<span><?=$phone[$i];?></span></p>

                                    <p>上车地: <span><?=$shangche[$i];?></span></p>

                                    

                                    <p>备注 :  <?=$text[$i];?>！</p>

                                </div>

                                <div style="clear:both"></div>

                                <?php

								  }

								?>

                            </div>
                        </div>

						<?php

						 }

						?>						

                    </div>

                   <?php

					if($pagenum > $pagesize){

					?> 

                    <?php

						echo "<div class=\"pagination\"><ul>";

						$url = "user_baoming_list.php?newsid=$newsid";//当前页面

						pagebar($pagecount, $pageval, 5, $url);

						echo "</ul></div>";

					}

				   ?>

					 

					

                </div>

            </div>

        </div>

    </div>

    <!--member center-->

    <!--foot begin-->

    <? include("_include.bottom.footbar.php") ?>

    <!--foot begin-->

    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>

    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>

    <script type="text/javascript" src="js/main.js"></script>

    <script type="text/javascript" src="js/sq.js"></script>

    <script type="text/javascript" src="layer/layer.js"></script>

    <script type="text/javascript" src="js/alert.js"></script>

</body>

</html>

